home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / macros / latex209 / contrib / harvard / jmr.bst < prev    next >
Text File  |  1994-06-16  |  25KB  |  1,341 lines

  1. % BibTeX standard bibliography style `jmr' (one of the harvard family)
  2.     % version 0.99a for BibTeX versions 0.99a or later, LaTeX version 2.09.
  3.     % Copyright (C) 1991, all rights reserved.
  4.     % Copying of this file is authorized only if either
  5.     % (1) you make absolutely no changes to your copy, including name, or
  6.     % (2) if you do make changes, you name it something other than
  7.     % btxbst.doc, plain.bst, unsrt.bst, alpha.bst, abbrv.bst, agsm.bst,
  8.         % dcu.bst or kluwer.bst, jmr.bst.
  9.     % This restriction helps ensure that all standard styles are identical.
  10.     % The file harvard.tex has the documentation for this style.
  11.  
  12. % ACKNOWLEDGEMENT:
  13. %   This document is a modified version of alpha.bst to which it owes much of
  14. %   its functionality.
  15.  
  16. % AUTHOR
  17. %   Peter Williams, Key Centre for Design Quality, Sydney University
  18. %   e-mail: peterw@archsci.arch.su.oz.au
  19.  
  20. ENTRY
  21.   { address
  22.     author
  23.     booktitle
  24.     chapter
  25.     edition
  26.     editor
  27.     howpublished
  28.     institution
  29.     journal
  30.     key
  31.     month
  32.     note
  33.     number
  34.     organization
  35.     pages
  36.     publisher
  37.     school
  38.     series
  39.     title
  40.     type
  41.     volume
  42.     year
  43.   }
  44.   { field.used etal.allowed etal.required} %%%XXX change
  45.   { extra.label sort.label list.year }
  46.  
  47. INTEGERS { output.state before.all mid.sentence after.sentence after.block }
  48.  
  49. FUNCTION {init.state.consts}
  50. { #0 'before.all :=
  51.   #1 'mid.sentence :=
  52.   #2 'after.sentence :=
  53.   #3 'after.block :=
  54. }
  55.  
  56. STRINGS { s t f }
  57.  
  58. FUNCTION {output.nonnull}
  59. { 's :=
  60.   output.state mid.sentence =
  61.     { ", " * write$ }
  62.     { output.state after.block =
  63.     { add.period$ write$
  64.       newline$
  65.       "\newblock " write$
  66.     }
  67.     { output.state before.all =
  68.         'write$
  69.         { add.period$ " " * write$ }
  70.       if$
  71.     }
  72.       if$
  73.       mid.sentence 'output.state :=
  74.     }
  75.   if$
  76.   s
  77. }
  78.  
  79. FUNCTION {output}
  80. { duplicate$ empty$
  81.     'pop$
  82.     'output.nonnull
  83.   if$
  84. }
  85.  
  86. FUNCTION {output.check}
  87. { 't :=
  88.   duplicate$ empty$
  89.     { pop$ "empty " t * " in " * cite$ * warning$ }
  90.     'output.nonnull
  91.   if$
  92. }
  93.  
  94. FUNCTION {item.check}
  95. { 't :=
  96.   empty$
  97.     { "empty " t * " in " * cite$ * warning$ }
  98.     { skip$ }
  99.   if$
  100. }
  101.  
  102. FUNCTION {fin.entry}
  103. { add.period$
  104.   write$
  105.   newline$
  106. }
  107.  
  108. FUNCTION {new.block}
  109. { output.state before.all =
  110.     'skip$
  111.     { after.block 'output.state := }
  112.   if$
  113. }
  114.  
  115. FUNCTION {not}
  116. {   { #0 }
  117.     { #1 }
  118.   if$
  119. }
  120.  
  121. FUNCTION {and}
  122. {   'skip$
  123.     { pop$ #0 }
  124.   if$
  125. }
  126.  
  127. FUNCTION {or}
  128. {   { pop$ #1 }
  129.     'skip$
  130.   if$
  131. }
  132.  
  133. FUNCTION {field.or.null}
  134. { duplicate$ empty$
  135.     { pop$ "" }
  136.     'skip$
  137.   if$
  138. }
  139.  
  140. FUNCTION {emphasize}
  141. { duplicate$ empty$
  142.     { pop$ "" }
  143.     { "{\em " swap$ * "}" * }
  144.   if$
  145. }
  146.  
  147. FUNCTION {embolden}
  148. { duplicate$ empty$
  149.     { pop$ "" }
  150.     { "{\bf " swap$ * "}" * }
  151.   if$
  152. }
  153.  
  154. FUNCTION {quote}
  155. { duplicate$ empty$
  156.     { pop$ "" }
  157.     { "`" swap$ * "'" * }
  158.   if$
  159. }
  160.  
  161. INTEGERS { nameptr namesleft numnames }
  162.  
  163. FUNCTION {format.rem.names}
  164. { 's :=
  165.   'f :=
  166.   #2 'nameptr :=
  167.   s num.names$ 'numnames :=
  168.   numnames #1 - 'namesleft :=
  169.     { namesleft #0 > }
  170.     { s nameptr f format.name$ 't :=
  171.       nameptr #1 >
  172.     { namesleft #1 >
  173.         { ", " * t * }
  174.         { t "others" =
  175.         { " et~al." * }
  176.         { " \harvardand\ " * t * }
  177.           if$
  178.         }
  179.       if$
  180.     }
  181.     't
  182.       if$
  183.       nameptr #1 + 'nameptr :=
  184.       namesleft #1 - 'namesleft :=
  185.     }
  186.   while$
  187. }
  188.  
  189. FUNCTION {format.authors}
  190. { author empty$
  191.     { "" }
  192.     { author #1 "{vv~}{ll}{, jj}{, ff}" format.name$
  193.       "{ff }{vv~}{ll}{, jj}" author format.rem.names
  194.     }
  195.   if$
  196. }
  197.  
  198. FUNCTION {format.editors}
  199. { editor empty$
  200.     { "" }
  201.     { editor #1 "{vv~}{ll}{, jj}{, ff}" format.name$
  202.       "{ff }{vv~}{ll}{, jj}" editor format.rem.names
  203.       editor num.names$ #1 >
  204.     { ", eds" * }
  205.     { ", ed." * }
  206.       if$
  207.     }
  208.   if$
  209. }
  210.  
  211. FUNCTION {format.editors.reverse}
  212. { editor empty$
  213.     { "" }
  214.     { editor #1 "{f.}{vv~}{ll}{, jj}" format.name$
  215.       "{f.}{vv~}{ll}{, jj}" editor format.rem.names
  216.       editor num.names$ #1 >
  217.     { ", eds" * }
  218.     { ", ed." * }
  219.       if$
  220.     }
  221.   if$
  222. }
  223.  
  224. FUNCTION {format.title}
  225. { title empty$
  226.     { "" }
  227.     { title "t" change.case$ }
  228.   if$
  229. }
  230.  
  231. FUNCTION {n.dashify}
  232. { 't :=
  233.   ""
  234.     { t empty$ not }
  235.     { t #1 #1 substring$ "-" =
  236.     { t #1 #2 substring$ "--" = not
  237.         { "--" *
  238.           t #2 global.max$ substring$ 't :=
  239.         }
  240.         {   { t #1 #1 substring$ "-" = }
  241.         { "-" *
  242.           t #2 global.max$ substring$ 't :=
  243.         }
  244.           while$
  245.         }
  246.       if$
  247.     }
  248.     { t #1 #1 substring$ *
  249.       t #2 global.max$ substring$ 't :=
  250.     }
  251.       if$
  252.     }
  253.   while$
  254. }
  255.  
  256. FUNCTION {format.btitle}
  257. { title emphasize
  258. }
  259.  
  260. FUNCTION {tie.or.space.connect}
  261. { duplicate$ text.length$ #3 <
  262.     { "~" }
  263.     { " " }
  264.   if$
  265.   swap$ * *
  266. }
  267.  
  268. FUNCTION {either.or.check}
  269. { empty$
  270.     'pop$
  271.     { "can't use both " swap$ * " fields in " * cite$ * warning$ }
  272.   if$
  273. }
  274.  
  275. FUNCTION {format.bvolume}
  276. { volume empty$
  277.     { "" }
  278.     { "Vol." volume tie.or.space.connect
  279.       series empty$
  280.     'skip$
  281.     { " of " * series emphasize * }
  282.       if$
  283.       "volume and number" number either.or.check
  284.     }
  285.   if$
  286. }
  287.  
  288. FUNCTION {format.number.series}
  289. { volume empty$
  290.     { number empty$
  291.     { series field.or.null }
  292.     { output.state mid.sentence =
  293.         { "number" }
  294.         { "Number" }
  295.       if$
  296.       number tie.or.space.connect
  297.       series empty$
  298.         { "there's a number but no series in " cite$ * warning$ }
  299.         { " {\em in} " * series quote * }
  300.       if$
  301.     }
  302.       if$
  303.     }
  304.     { "" }
  305.   if$
  306. }
  307.  
  308. FUNCTION {format.edition}
  309. { edition empty$
  310.     { "" }
  311.     { output.state mid.sentence =
  312.     { edition "l" change.case$ " edn" * }
  313.     { edition "t" change.case$ " edn" * }
  314.       if$
  315.     }
  316.   if$
  317. }
  318.  
  319. INTEGERS { multiresult }
  320.  
  321. FUNCTION {multi.page.check}
  322. { 't :=
  323.   #0 'multiresult :=
  324.     { multiresult not
  325.       t empty$ not
  326.       and
  327.     }
  328.     { t #1 #1 substring$
  329.       duplicate$ "-" =
  330.       swap$ duplicate$ "," =
  331.       swap$ "+" =
  332.       or or
  333.     { #1 'multiresult := }
  334.     { t #2 global.max$ substring$ 't := }
  335.       if$
  336.     }
  337.   while$
  338.   multiresult
  339. }
  340.  
  341. FUNCTION {format.pages}
  342. { pages empty$
  343.     { "" }
  344.     { pages multi.page.check
  345.     { "pp.~" pages n.dashify * }
  346.     { "p.~" pages * }
  347.       if$
  348.     }
  349.   if$
  350. }
  351.  
  352. FUNCTION {format.vol.num.pages}
  353. { volume embolden field.or.null
  354.   number empty$
  355.     'skip$
  356.     { "(" number * ")" * *
  357.       volume empty$
  358.     { "there's a number but no volume in " cite$ * warning$ }
  359.     'skip$
  360.       if$
  361.     }
  362.   if$
  363.   pages empty$
  364.     'skip$
  365.     { duplicate$ empty$
  366.     { pop$ format.pages }
  367.     { ",~" * pages n.dashify * }
  368.       if$
  369.     }
  370.   if$
  371. }
  372.  
  373. FUNCTION {format.chapter.pages}
  374. { chapter empty$
  375.     'format.pages
  376.     { type empty$
  377.     { "chapter" }
  378.     { type "l" change.case$ }
  379.       if$
  380.       chapter tie.or.space.connect
  381.       pages empty$
  382.     'skip$
  383.     { ", " * format.pages * }
  384.       if$
  385.     }
  386.   if$
  387. }
  388.  
  389. FUNCTION {format.in.ed.booktitle}
  390. { booktitle empty$
  391.     { "" }
  392.     { editor empty$
  393.     { "{\em in} " booktitle quote * }
  394.     { "{\em in} " format.editors.reverse * ", " * booktitle quote * }
  395.       if$
  396.     }
  397.   if$
  398. }
  399.  
  400. FUNCTION {empty.misc.check}
  401. { author empty$ title empty$ howpublished empty$
  402.   month empty$ year empty$ note empty$
  403.   and and and and and
  404.   key empty$ not and
  405.     { "all relevant fields are empty in " cite$ * warning$ }
  406.     'skip$
  407.   if$
  408. }
  409.  
  410. FUNCTION {format.thesis.type}
  411. { type empty$
  412.     'skip$
  413.     { pop$
  414.       type "t" change.case$
  415.     }
  416.   if$
  417. }
  418.  
  419. FUNCTION {format.tr.number}
  420. { type empty$
  421.     { "Technical Report" }
  422.     'type
  423.   if$
  424.   number empty$
  425.     { "t" change.case$ }
  426.     { number tie.or.space.connect }
  427.   if$
  428. }
  429.  
  430. FUNCTION {format.article.crossref}
  431. { key empty$
  432.     { journal empty$
  433.     { "need key or journal for " cite$ * " to crossref " * crossref *
  434.       warning$
  435.       ""
  436.     }
  437.     { "in {\em " journal * "\/} \cite{" * crossref * "}" *}
  438.       if$
  439.     }
  440.     { "{\em in} \citeasnoun{" crossref * "}" * }
  441.   if$
  442.  
  443. }
  444.  
  445. FUNCTION {format.book.crossref}
  446. { volume empty$
  447.     { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
  448.       "in "
  449.     }
  450.     { "Vol." volume tie.or.space.connect
  451.       " of " *
  452.     }
  453.   if$
  454.   editor empty$
  455.   editor field.or.null author field.or.null =
  456.   or
  457.     { key empty$
  458.     { series empty$
  459.         { "need editor, key, or series for " cite$ * " to crossref " *
  460.           crossref * warning$
  461.           "" *
  462.         }
  463.         { "{\em " * series * "\/} \cite{" * crossref * "}" *}
  464.       if$
  465.     }
  466.     { " \citeasnoun{" * crossref * "}" * }
  467.       if$
  468.     }
  469.     { " \citeasnoun{" * crossref * "}" * }
  470.   if$
  471. }
  472.  
  473. FUNCTION {format.incoll.inproc.crossref}
  474. { editor empty$
  475.   editor field.or.null author field.or.null =
  476.   or
  477.     { key empty$
  478.     { booktitle empty$
  479.         { "need editor, key, or booktitle for " cite$ * " to crossref " *
  480.           crossref * warning$
  481.           ""
  482.         }
  483.         { "in {\em " booktitle * "\/}" * " \cite{" * crossref * "}" *}
  484.       if$
  485.     }
  486.     { "{\em in} \citeasnoun{" crossref * "}" * }
  487.       if$
  488.     }
  489.     { "{\em in} \citeasnoun{" crossref * "}" * }
  490.   if$
  491.   
  492. }
  493.  
  494. INTEGERS { len }
  495.  
  496. FUNCTION {chop.word}
  497. { 's :=
  498.   'len :=
  499.   s #1 len substring$ =
  500.     { s len #1 + global.max$ substring$ }
  501.     's
  502.   if$
  503. }
  504.  
  505. INTEGERS { ind tsslen }
  506.  
  507. STRINGS { tss ret rss istr }
  508.  
  509. FUNCTION {replace.substring}{
  510.   'rss :=
  511.   'tss :=
  512.   'istr :=
  513.   "" 'ret :=
  514.   tss text.length$ 'tsslen :=
  515.   #1 'ind :=
  516.     { istr ind tsslen substring$ "" = not }
  517.     { istr ind tsslen substring$ tss =
  518.         { ret rss * 'ret :=
  519.           ind tsslen + 'ind :=
  520.         }
  521.         { ret istr ind #1 substring$ * 'ret :=
  522.           ind #1 + 'ind :=
  523.         }
  524.       if$
  525.     }
  526.   while$
  527.   ret
  528. }
  529.  
  530. FUNCTION {format.lab.names.abbr}
  531. { 's :=
  532.   s num.names$ 'numnames :=
  533.   numnames #1 >
  534.     { numnames #2 >
  535.     { s #1 "{vv~}{ll}" format.name$ " et~al." * }
  536.     { s #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
  537.             { s #1 "{vv~}{ll}" format.name$ " et~al." * }
  538.         { s #1 "{vv~}{ll}" format.name$ " \harvardand\ " *
  539.               s #2 "{vv~}{ll}" format.name$ * 
  540.             }
  541.           if$
  542.         }
  543.       if$
  544.     }
  545.     { s #1 "{ff }{vv~}{ll}" format.name$ }
  546.   if$
  547. }
  548.  
  549. FUNCTION {format.lab.names.full}
  550. { 's :=
  551.   #1 'nameptr :=
  552.   s num.names$ 'numnames :=
  553.   numnames 'namesleft :=
  554.     { namesleft #0 > }
  555.     { s nameptr "{vv~}{ll}" format.name$ 't :=
  556.       nameptr #1 >
  557.     { namesleft #1 >
  558.         { ", " * t * }
  559.         { t "others" =
  560.         { " et~al." * }
  561.         { " \harvardand\ " * t * }
  562.           if$
  563.         }
  564.       if$
  565.     }
  566.     't
  567.       if$
  568.       nameptr #1 + 'nameptr :=
  569.       namesleft #1 - 'namesleft :=
  570.     }
  571.   while$
  572. }
  573.  
  574. INTEGERS { author.field editor.field organization.field title.field key.field }
  575.  
  576. FUNCTION {init.field.constants}
  577. { #0 'author.field :=
  578.   #1 'editor.field :=
  579.   #2 'organization.field :=
  580.   #3 'title.field :=
  581.   #4 'key.field :=
  582. }
  583.  
  584. FUNCTION {make.list.label}
  585. { author.field field.used =
  586.     { format.authors }
  587.     { editor.field field.used =
  588.         { format.editors }
  589.         { organization.field field.used =
  590.             { "The " #4 organization chop.word #3 text.prefix$ }
  591.             { title.field field.used =
  592.                 { format.btitle }
  593.                 { key.field field.used =
  594.                     { key #3 text.prefix$ }
  595.                     { "Internal error :001 on " cite$ * " label" * warning$ }
  596.                   if$
  597.                 }
  598.               if$
  599.             }
  600.           if$
  601.         }
  602.       if$
  603.     }
  604.   if$
  605. }
  606.  
  607. FUNCTION {make.full.label}
  608. { author.field field.used =
  609.     { author format.lab.names.full }
  610.     { editor.field field.used =
  611.         { editor format.lab.names.full }
  612.         { organization.field field.used =
  613.             { "The " #4 organization chop.word #3 text.prefix$ }
  614.             { title.field field.used =
  615.                 { format.btitle }
  616.                 { key.field field.used =
  617.                     { key #3 text.prefix$ }
  618.                     { "Internal error :001 on " cite$ * " label" * warning$ }
  619.                   if$
  620.                 }
  621.               if$
  622.             }
  623.           if$
  624.         }
  625.       if$
  626.     }
  627.   if$
  628. }
  629.  
  630. FUNCTION {make.abbr.label} %%%XXX change
  631. {
  632.   etal.allowed
  633.     { author.field field.used =
  634.         { author format.lab.names.abbr }
  635.         { editor.field field.used =
  636.             { editor format.lab.names.abbr }
  637.             { organization.field field.used =
  638.                 { "The " #4 organization chop.word #3 text.prefix$ }
  639.                 { title.field field.used =
  640.                     { format.btitle }
  641.                     { key.field field.used =
  642.                         { key #3 text.prefix$ }
  643.                         {"Internal error :001 on " cite$ * " label" * warning$ }
  644.                       if$
  645.                     }
  646.                   if$
  647.                 }
  648.               if$
  649.             }
  650.           if$
  651.         }
  652.       if$
  653.     }
  654.     { make.full.label }
  655.   if$
  656. }
  657.  
  658. FUNCTION {output.bibitem}
  659. { newline$
  660.   etal.allowed        %%%XXX change
  661.   etal.required
  662.   and
  663.     {
  664.       "\harvarditem[" write$
  665.       make.abbr.label write$
  666.       "]{" write$
  667.     }
  668.     {
  669.       "\harvarditem{" write$
  670.     }
  671.   if$
  672.   make.full.label write$
  673.   "}{" write$
  674.   list.year write$
  675.   "}{" write$
  676.   cite$ write$
  677.   "}" write$
  678.   newline$
  679.   ""
  680.   before.all 'output.state :=
  681. }
  682.  
  683. FUNCTION {list.label.output}
  684. { make.list.label " " * write$
  685. }
  686.  
  687. FUNCTION {article}
  688. { output.bibitem
  689.   list.label.output
  690.   " \harvardleft " list.year * "\harvardright " * output.nonnull
  691.   author "author" item.check
  692.   title.field field.used =
  693.     { skip$ }
  694.     { format.title quote "title" output.check }
  695.   if$
  696.   crossref missing$
  697.     { journal emphasize "journal" duplicate$ item.check
  698.       pages empty$
  699.         {
  700.           output
  701.         }
  702.         {
  703.           " " *
  704.           format.vol.num.pages * output
  705.         }
  706.       if$
  707.     }
  708.     { format.article.crossref output.nonnull
  709.       format.pages output
  710.     }
  711.   if$
  712.   new.block
  713.   note output
  714.   fin.entry
  715. }
  716.  
  717. FUNCTION {book}
  718. { output.bibitem
  719.   list.label.output
  720.   " \harvardleft " list.year * "\harvardright " * output.nonnull
  721.   author empty$
  722.     { editor "author and editor" item.check }
  723.     { crossref missing$
  724.     { "author and editor" editor either.or.check }
  725.     'skip$
  726.       if$
  727.     }
  728.   if$
  729.   title.field field.used =
  730.     { skip$ }
  731.     { format.btitle "title" output.check }
  732.   if$
  733.   crossref missing$
  734.     { format.bvolume output
  735.       format.number.series output
  736.       format.edition output
  737.       publisher "publisher" output.check
  738.       address output
  739.     }
  740.     { format.book.crossref output.nonnull
  741.       format.edition output
  742.     }
  743.   if$
  744.   new.block
  745.   note output
  746.   fin.entry
  747. }
  748.  
  749. FUNCTION {booklet}
  750. { output.bibitem
  751.   list.label.output
  752.   " \harvardleft " list.year * "\harvardright " * output.nonnull
  753.   title.field field.used =
  754.     { skip$ }
  755.     { format.title quote "title" output.check }
  756.   if$
  757.   howpublished output
  758.   address output
  759.   new.block
  760.   note output
  761.   fin.entry
  762. }
  763.  
  764. FUNCTION {inbook}
  765. { output.bibitem
  766.   list.label.output
  767.   " \harvardleft " list.year * "\harvardright " * output.nonnull
  768.   author empty$
  769.     { editor "author and editor" item.check }
  770.     { crossref missing$
  771.     { "author and editor" editor either.or.check }
  772.     'skip$
  773.       if$
  774.     }
  775.   if$
  776.   title.field field.used =
  777.     { skip$ }
  778.     { format.btitle "title" output.check }
  779.   if$
  780.   crossref missing$
  781.     { format.bvolume output
  782.       format.number.series output
  783.       format.edition output
  784.       publisher "publisher" output.check
  785.       address output
  786.     }
  787.     { format.book.crossref output.nonnull
  788.       format.edition output
  789.     }
  790.   if$
  791.   format.chapter.pages "chapter and pages" output.check
  792.   new.block
  793.   note output
  794.   fin.entry
  795. }
  796.  
  797. FUNCTION {incollection}
  798. { output.bibitem
  799.   list.label.output
  800.   " \harvardleft " list.year * "\harvardright " * output.nonnull
  801.   title.field field.used =
  802.     { skip$ }
  803.     { format.title "title" output.check }
  804.   if$
  805.   author "author" item.check
  806.   crossref missing$
  807.     { format.in.ed.booktitle "booktitle" output.check
  808.       format.edition output
  809.       format.bvolume output
  810.       format.number.series output
  811.       publisher "publisher" output.check
  812.       address output
  813.     }
  814.     { format.incoll.inproc.crossref output.nonnull
  815.     }
  816.   if$
  817.   format.chapter.pages output
  818.   new.block
  819.   note output
  820.   fin.entry
  821. }
  822.  
  823. FUNCTION {inproceedings}
  824. { output.bibitem
  825.   list.label.output
  826.   " \harvardleft " list.year * "\harvardright " * output.nonnull
  827.   title.field field.used =
  828.     { skip$ }
  829.     { format.title "title" output.check }
  830.   if$
  831.   author "author" item.check
  832.   crossref missing$
  833.     { format.in.ed.booktitle "booktitle" output.check
  834.       format.bvolume output
  835.       format.number.series output
  836.       address empty$
  837.     { organization output
  838.       publisher output
  839.     }
  840.     { organization output
  841.       publisher output
  842.           address output.nonnull
  843.      }
  844.       if$
  845.     }
  846.     { format.incoll.inproc.crossref output.nonnull
  847.     }
  848.   if$
  849.   format.pages output
  850.   new.block
  851.   note output
  852.   fin.entry
  853. }
  854.  
  855. FUNCTION {conference} { inproceedings }
  856.  
  857. FUNCTION {manual}
  858. { output.bibitem
  859.   list.label.output
  860.   " \harvardleft " list.year * "\harvardright " * output.nonnull
  861.   title.field field.used =
  862.     { skip$ }
  863.     { format.btitle "title" output.check }
  864.   if$
  865.   format.edition output
  866.   author empty$
  867.     { organization empty$
  868.     { address output }
  869.     'skip$
  870.       if$
  871.     }
  872.     { organization output
  873.       address output
  874.     }
  875.   if$
  876.   new.block
  877.   note output
  878.   fin.entry
  879. }
  880.  
  881. FUNCTION {mastersthesis}
  882. { output.bibitem
  883.   list.label.output
  884.   " \harvardleft " list.year * "\harvardright " * output.nonnull
  885.   author "author" item.check
  886.   title.field field.used =
  887.     { skip$ }
  888.     { format.title "title" output.check }
  889.   if$
  890.   "Master's thesis" format.thesis.type output.nonnull
  891.   school "school" output.check
  892.   address output
  893.   new.block
  894.   note output
  895.   fin.entry
  896. }
  897.  
  898. FUNCTION {misc}
  899. { output.bibitem
  900.   list.label.output
  901.   " \harvardleft " list.year * "\harvardright " * output.nonnull
  902.   title.field field.used =
  903.     { skip$ }
  904.     { format.title quote output }
  905.   if$
  906.   howpublished output
  907.   new.block
  908.   note output
  909.   fin.entry
  910.   empty.misc.check
  911. }
  912.  
  913. FUNCTION {phdthesis}
  914. { output.bibitem
  915.   list.label.output
  916.   " \harvardleft " list.year * "\harvardright " * output.nonnull
  917.   author "author" item.check
  918.   title.field field.used =
  919.     { skip$ }
  920.     { title "title" output.check }
  921.   if$
  922.   "PhD thesis" format.thesis.type output.nonnull
  923.   school "school" output.check
  924.   address output
  925.   new.block
  926.   note output
  927.   fin.entry
  928. }
  929.  
  930. FUNCTION {proceedings}
  931. { output.bibitem
  932.   list.label.output
  933.   " \harvardleft " list.year * "\harvardright " * output.nonnull
  934.   title.field field.used =
  935.     { skip$ }
  936.     { format.btitle "title" output.check }
  937.   if$
  938.   format.bvolume output
  939.   format.number.series output
  940.   address empty$
  941.     { editor empty$
  942.     { skip$ }
  943.     { organization output
  944.     }
  945.       if$
  946.       publisher output
  947.     }
  948.     { editor empty$
  949.     'skip$
  950.     { organization output }
  951.       if$
  952.       publisher output
  953.       address output.nonnull
  954.     }
  955.   if$
  956.   new.block
  957.   note output
  958.   fin.entry
  959. }
  960.  
  961. FUNCTION {techreport}
  962. { output.bibitem
  963.   list.label.output
  964.   " \harvardleft " list.year * "\harvardright " * output.nonnull
  965.   author "author" item.check
  966.   title.field field.used =
  967.     { skip$ }
  968.     { format.title "title" output.check }
  969.   if$
  970.   format.tr.number output.nonnull
  971.   institution "institution" output.check
  972.   address output
  973.   new.block
  974.   note output
  975.   fin.entry
  976. }
  977.  
  978. FUNCTION {unpublished}
  979. { output.bibitem
  980.   list.label.output
  981.   " \harvardleft " list.year * "\harvardright " * output.nonnull
  982.   author "author" item.check
  983.   title.field field.used =
  984.     { skip$ }
  985.     { format.title "title" output.check }
  986.   if$
  987.   note "note" output.check
  988.   fin.entry
  989. }
  990.  
  991. FUNCTION {default.type} { misc }
  992.  
  993. MACRO {jan} {"January"}
  994.  
  995. MACRO {feb} {"February"}
  996.  
  997. MACRO {mar} {"March"}
  998.  
  999. MACRO {apr} {"April"}
  1000.  
  1001. MACRO {may} {"May"}
  1002.  
  1003. MACRO {jun} {"June"}
  1004.  
  1005. MACRO {jul} {"July"}
  1006.  
  1007. MACRO {aug} {"August"}
  1008.  
  1009. MACRO {sep} {"September"}
  1010.  
  1011. MACRO {oct} {"October"}
  1012.  
  1013. MACRO {nov} {"November"}
  1014.  
  1015. MACRO {dec} {"December"}
  1016.  
  1017. MACRO {acmcs} {"ACM Computing Surveys"}
  1018.  
  1019. MACRO {acta} {"Acta Informatica"}
  1020.  
  1021. MACRO {cacm} {"Communications of the ACM"}
  1022.  
  1023. MACRO {ibmjrd} {"IBM Journal of Research and Development"}
  1024.  
  1025. MACRO {ibmsj} {"IBM Systems Journal"}
  1026.  
  1027. MACRO {ieeese} {"IEEE Transactions on Software Engineering"}
  1028.  
  1029. MACRO {ieeetc} {"IEEE Transactions on Computers"}
  1030.  
  1031. MACRO {ieeetcad}
  1032.  {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"}
  1033.  
  1034. MACRO {ipl} {"Information Processing Letters"}
  1035.  
  1036. MACRO {jacm} {"Journal of the ACM"}
  1037.  
  1038. MACRO {jcss} {"Journal of Computer and System Sciences"}
  1039.  
  1040. MACRO {scp} {"Science of Computer Programming"}
  1041.  
  1042. MACRO {sicomp} {"SIAM Journal on Computing"}
  1043.  
  1044. MACRO {tocs} {"ACM Transactions on Computer Systems"}
  1045.  
  1046. MACRO {tods} {"ACM Transactions on Database Systems"}
  1047.  
  1048. MACRO {tog} {"ACM Transactions on Graphics"}
  1049.  
  1050. MACRO {toms} {"ACM Transactions on Mathematical Software"}
  1051.  
  1052. MACRO {toois} {"ACM Transactions on Office Information Systems"}
  1053.  
  1054. MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"}
  1055.  
  1056. MACRO {tcs} {"Theoretical Computer Science"}
  1057.  
  1058. READ
  1059.  
  1060. EXECUTE {init.field.constants}
  1061.  
  1062. FUNCTION {sortify}
  1063. { purify$
  1064.   "l" change.case$
  1065. }
  1066.  
  1067. FUNCTION {sortify.names}
  1068. { " \harvardand\ " " " replace.substring
  1069.   " et~al." " zzz" replace.substring
  1070.   sortify
  1071. }
  1072.  
  1073. FUNCTION {author.key.label}
  1074. { author empty$
  1075.     { key empty$
  1076.     { title.field 'field.used := }
  1077.     { key.field 'field.used := }
  1078.       if$
  1079.     }
  1080.     { author.field 'field.used := }
  1081.   if$
  1082. }
  1083.  
  1084. FUNCTION {author.editor.key.label}
  1085. { author empty$
  1086.     { editor empty$
  1087.     { key empty$
  1088.         { title.field 'field.used := }
  1089.         { key.field 'field.used := }
  1090.       if$
  1091.       }
  1092.     { editor.field 'field.used := }
  1093.       if$
  1094.     }
  1095.     { author.field 'field.used := }
  1096.   if$
  1097. }
  1098.  
  1099. FUNCTION {author.key.organization.label}
  1100. { author empty$
  1101.     { key empty$
  1102.     { organization empty$
  1103.         { title.field 'field.used := }
  1104.         { organization.field 'field.used := }
  1105.       if$
  1106.     }
  1107.     { key.field 'field.used := }
  1108.       if$
  1109.     }
  1110.     { author.field 'field.used := }
  1111.   if$
  1112. }
  1113.  
  1114. FUNCTION {editor.key.organization.label}
  1115. { editor empty$
  1116.     { key empty$
  1117.     { organization empty$
  1118.         { title.field 'field.used := }
  1119.         { organization.field 'field.used := }
  1120.       if$
  1121.     }
  1122.     { key.field 'field.used := }
  1123.       if$
  1124.     }
  1125.     { editor.field 'field.used := }
  1126.   if$
  1127. }
  1128.  
  1129. FUNCTION {sort.format.title}
  1130. { 't :=
  1131.   "A " #2
  1132.     "An " #3
  1133.       "The " #4 t chop.word
  1134.     chop.word
  1135.   chop.word
  1136.   sortify
  1137.   #1 global.max$ substring$
  1138. }
  1139.  
  1140. FUNCTION {calc.label} %%%XXX change
  1141. { make.abbr.label
  1142.   title.field field.used =
  1143.     { sort.format.title }
  1144.     { sortify.names }
  1145.   if$
  1146.   year field.or.null purify$ #-1 #4 substring$ sortify
  1147.   *
  1148.   'sort.label :=
  1149. }
  1150.  
  1151. FUNCTION {preliminaries} %%%XXX change
  1152. { type$ "book" =
  1153.   type$ "inbook" =
  1154.   or
  1155.     'author.editor.key.label
  1156.     { type$ "proceedings" =
  1157.     'editor.key.organization.label
  1158.     { type$ "manual" =
  1159.         'author.key.organization.label
  1160.         'author.key.label
  1161.       if$
  1162.     }
  1163.       if$
  1164.     }
  1165.   if$
  1166.   author.field field.used = %%%XXX change
  1167.     {
  1168.       author num.names$ #2 >
  1169.         { #1 }
  1170.         { #0 }
  1171.       if$
  1172.       'etal.required :=
  1173.     }
  1174.     {
  1175.       editor.field field.used = 
  1176.         {
  1177.           editor num.names$ #2 >
  1178.             { #1 }
  1179.             { #0 }
  1180.           if$
  1181.         }
  1182.         { #0 }
  1183.       if$
  1184.       'etal.required :=
  1185.     }
  1186.   if$
  1187.   #1 'etal.allowed :=
  1188. }
  1189.  
  1190. FUNCTION {first.presort}
  1191. { calc.label
  1192.   sort.label
  1193.   title.field field.used =
  1194.     { skip$ }
  1195.     { "    "
  1196.       *
  1197.       make.list.label sortify.names
  1198.       *
  1199.       "    "
  1200.       *
  1201.       title field.or.null
  1202.       sort.format.title
  1203.       *
  1204.     }
  1205.   if$
  1206.   #1 entry.max$ substring$
  1207.   'sort.key$ :=
  1208. }
  1209.  
  1210. ITERATE {preliminaries}
  1211.  
  1212. ITERATE {first.presort}
  1213.  
  1214. SORT
  1215.  
  1216. STRINGS { last.sort.label next.extra last.full.label}
  1217.  
  1218. INTEGERS { last.extra.num last.etal.allowed}
  1219.  
  1220. FUNCTION {initialize.confusion}
  1221. { #0 int.to.chr$ 'last.sort.label :=
  1222.   #0 int.to.chr$ 'last.full.label :=
  1223.   #1 'last.etal.allowed :=
  1224. }
  1225.  
  1226. FUNCTION {confusion.pass}
  1227. { last.sort.label sort.label =
  1228.     { last.etal.allowed 
  1229.         { last.full.label make.full.label sortify.names =
  1230.             { skip$ }
  1231.             { #0 'etal.allowed :=
  1232.               #0 'last.etal.allowed :=
  1233.             }
  1234.           if$
  1235.         }
  1236.         { #0 'etal.allowed := }
  1237.       if$
  1238.     }
  1239.     { sort.label 'last.sort.label :=
  1240.       make.full.label sortify.names 'last.full.label :=
  1241.       #1 'last.etal.allowed :=
  1242.     }
  1243.   if$
  1244. }
  1245.  
  1246. EXECUTE {initialize.confusion}
  1247.  
  1248. ITERATE {confusion.pass}
  1249.  
  1250. EXECUTE {initialize.confusion}
  1251.  
  1252. REVERSE {confusion.pass}
  1253.  
  1254. FUNCTION {initialize.last.extra.num}
  1255. { #0 int.to.chr$ 'last.sort.label :=
  1256.   "" 'next.extra :=
  1257.   #0 'last.extra.num :=
  1258. }
  1259.  
  1260. FUNCTION {forward.pass}
  1261. { last.sort.label sort.label =
  1262.     { last.extra.num #1 + 'last.extra.num :=
  1263.       last.extra.num int.to.chr$ 'extra.label :=
  1264.     }
  1265.     { "a" chr.to.int$ 'last.extra.num :=
  1266.       "" 'extra.label :=
  1267.       sort.label 'last.sort.label :=
  1268.     }
  1269.   if$
  1270. }
  1271.  
  1272. FUNCTION {reverse.pass}
  1273. { next.extra "b" =
  1274.     { "a" 'extra.label := }
  1275.     'skip$
  1276.   if$
  1277.   year empty$
  1278.     { "n.d." extra.label emphasize * 'list.year := }
  1279.     { year extra.label emphasize * 'list.year := }
  1280.   if$
  1281.   extra.label 'next.extra :=
  1282. }
  1283.  
  1284. ITERATE {first.presort}
  1285.  
  1286. SORT
  1287.  
  1288. EXECUTE {initialize.last.extra.num}
  1289.  
  1290. ITERATE {forward.pass}
  1291.  
  1292. REVERSE {reverse.pass}
  1293.  
  1294. FUNCTION {second.presort}
  1295. { make.list.label
  1296.   title.field field.used =
  1297.     { sort.format.title }
  1298.     { sortify.names }
  1299.   if$
  1300.   "    "
  1301.   *
  1302.   list.year field.or.null sortify
  1303.   *
  1304.   "    "
  1305.   *
  1306.   title.field field.used =
  1307.     { skip$ }
  1308.     { title field.or.null
  1309.       sort.format.title
  1310.       *
  1311.     }
  1312.   if$
  1313.   #1 entry.max$ substring$
  1314.   'sort.key$ :=
  1315. }
  1316.  
  1317. ITERATE {second.presort}
  1318.  
  1319. SORT
  1320.  
  1321. FUNCTION {begin.bib}
  1322. { preamble$ empty$
  1323.     'skip$
  1324.     { preamble$ write$ newline$ }
  1325.   if$
  1326.   "\begin{thebibliography}{xx}" write$ newline$
  1327. }
  1328.  
  1329. EXECUTE {begin.bib}
  1330.  
  1331. EXECUTE {init.state.consts}
  1332.  
  1333. ITERATE {call.type$}
  1334.  
  1335. FUNCTION {end.bib}
  1336. { newline$
  1337.   "\end{thebibliography}" write$ newline$
  1338. }
  1339.  
  1340. EXECUTE {end.bib}
  1341.